	

function TrimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}

	function validateSegment() {
		var submit;

		document.returnValue = true;
	// check title
		var TITLE = TrimString(document.getElementById('blogTitle').value);
		if( TITLE.length <= 0 ) {
			alert("Devi inserire un titolo per il blog!");
			document.returnValue = false;
			return;
		}
	// check descr
	//	it's handled server side due to possible use of tinymce
	//	the eventuality user create an event and forget to put a descriptio is quite unsual
	// check keywords
		var keys = TrimString(document.getElementById('keywords').value);
		if( keys.length > 0 ) {
			var ak = keys.split(",");
			if( ak.length < 3 ) {
				alert("Devi inserire almeno 3 keyword!");
				document.returnValue = false;
				return;
			}
		}else{
			alert("Devi inserire almeno 3 keyword!");
			document.returnValue = false;
			return;
		}

		if( document.getElementById('blogSubmit') )
			submit = document.getElementById('blogSubmit');
		submit.value = "wait...";
		submit.disabled = true;
	}   

